#pragma once
#ifndef OHOS_RIVE_THREAD_H
#define OHOS_RIVE_THREAD_H

#include <cstdint>
#include <mutex>
#include <unordered_map>

// Enable thread safety attributes only with clang.
// The attributes can be safely erased when compiling with other compilers.
#if defined(__clang__) && (!defined(SWIG))
#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
#else
#define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op
#endif

#define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))

#define REQUIRES(...) THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(__VA_ARGS__))

namespace ohos_rive {

enum class Affinity { None, Even, Odd };

int32_t getNumCpus();

void setAffinity(int32_t cpu);

void setAffinity(Affinity affinity);
} // namespace ohos_rive

#endif // OHOS_RIVE_THREAD_H
